package cc.comac.mom.config;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

import cc.comac.mom.util.ResultBean;

/*@Component
@Aspect*/
public class ServiceImpExceptionAop {
	
	@Pointcut(value = "execution(public cc.comac.mom.util.ResultBean cc.comac.mom.service.impl.*.* (..))")
	public void pointCut() {};
	
	@Around(value = "pointCut()")
	public ResultBean around(ProceedingJoinPoint proceedingJoinPoint)  {
		ResultBean resultBean = new ResultBean();
		try {
			resultBean = (ResultBean) proceedingJoinPoint.proceed(proceedingJoinPoint.getArgs());
		} catch (Throwable e) {
			resultBean.setErrorMessge(e.getMessage());
			e.printStackTrace();
		}
		return resultBean;
	}

}
